package com.ruoyi.safe.controller.app;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageResult;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.safe.service.ITTopicService;
import com.ruoyi.safe.vo.topic.TopicItemVO;
import com.ruoyi.safe.vo.topic.TopicKeywordAppDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static com.ruoyi.common.constant.Constants.APP_API_PREFIX;

@RestController
@RequestMapping(APP_API_PREFIX + "/safe/topic")
@Api(tags = "话题管理app接口")
public class TTopicAppController extends BaseController {
    @Resource
    private ITTopicService tTopicService;

    @ApiOperation(value = "查找热度前三的话题")
    @GetMapping("/hotThree")
    public R hot() {
        return R.ok(tTopicService.hotThree());
    }

    @ApiOperation(value = "关键字查找话题")
    @GetMapping("/selectByKeyword")
    public R<PageResult<TopicItemVO>> selectByKeyword(TopicKeywordAppDTO topicKeywordAppDTO) {

        PageResult<TopicItemVO> list = tTopicService.selectByKeyword(topicKeywordAppDTO);
        return R.ok(list);
    }
}
